#ifndef THREADCONDITION_H
#define THREADCONDITION_H
#pragma once
#include "../prohibitassignment.h"
#include "../lock/mutexlockguard.h"
/**
 * 线程条件类
 * @brief The ThreadCondition class
 */
class ThreadCondition: public ProhibitAssignment
{
public:
    explicit ThreadCondition(MutexLock & lock);

    ~ThreadCondition();

    // 线程等待
    void wait();

    // 线程通知
    void notify();

    // 通知全部线程
    void notifyAll();

    // 线程等待几秒
    bool waitForSecond(unsigned int seconds);

private:
    // 互拆锁
    MutexLock &lock;

    // 线程条件
    pthread_cond_t condition;
};

#endif // THREADCONDITION_H
